<?php

    function tvn_order_update_field($oid, $values) {
        return db_update('tvn_order')->fields($values)->condition('oid', $oid)->execute();
    }

    function tvn_order_get_data($status, $header) {
        $query = db_select('tvn_order', 'o')->extend('PagerDefault')->extend('TableSort');
        $query->fields('o');
        $query->condition('o.status', $status);
        $query->limit(50);
        $query->orderByHeader($header);
        return $query->execute();
    }

    function tvn_order_get_order_by_id($oid) {
        return db_select('tvn_order', 'o')->fields('o')->condition('o.oid', $oid)->execute()->fetchObject();
    }

